<template>
  <div element-loading-text='加载中,请稍后...' v-loading='comp==null?true:false'>
    <component v-if='comp!=null' :is='comp' v-bind='p' @events="onEvents"></component>
  </div>
</template>

<script lang="ts">
import {ContainerType} from 'tscommon/ts/EnumTypes';
import Vue from 'vue';
export default Vue.extend({
  data() {
    return {
      // comp: null,
      // p: {}
    };
  },
  props: {
    module: {
      type: Function,
      required: true
    },
    params: {
      type: Object,
      default: () => {
        return {};
      }
    },
    space: {
      type: Array
    }
  },
  methods:{
    onEvents(){
      this.$emit('events',...arguments);
    }
  },
  computed:<any>{
    p(){
      return { space: this.space, ...this.params };
    },
    comp(){
      return (<any>this).module( ContainerType.PC);
    }
  }
});
</script>
